package br.ufrn.cerescaico.sepe.dao;

import br.ufrn.cerescaico.sepe.Sepe;
import br.ufrn.cerescaico.sepe.beans.Perfil;
import br.ufrn.cerescaico.sepe.beans.Usuario;
import br.ufrn.cerescaico.sepe.dao.util.DataAccessLayerException;
import br.ufrn.cerescaico.sepe.dao.util.HibernateFactory;
import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.criterion.Restrictions;

/**
 * @author Taciano Morais Silva
 * @version 01/10/2010, 15h22m
 * @since 01/10/2010, 15h22m
 */
public class PerfilDao extends AbstractDao<Perfil> implements Dao<Perfil> {

    public PerfilDao(Sepe sepe) throws DataAccessLayerException {
        super(sepe);
    }

    /**
     *
     * @throws br.cesed.lti.cesuweb.dao.util.DataAccessLayerException
     */
    public PerfilDao() throws DataAccessLayerException {
        super();
    }

    /**
     * Insert a new Event into the database.
     * @param event
     */
    @Override
    public void create(Perfil perfil) throws DataAccessLayerException {
        super.saveOrUpdate(perfil);
    }

    /**
     * Delete a detached Event from the database.
     * @param event
     */
    @Override
    public void delete(Perfil perfil) throws DataAccessLayerException {
        super.delete(perfil);
    }

    /**
     * Delete a detached Event from the database.
     * @param id
     */
    @Override
    public void delete(Integer id) throws DataAccessLayerException {
        super.delete(Perfil.class, id);
    }

    /**
     * Find an Event by its primary key.
     * @param id
     * @return
     */
    @Override
    public Perfil find(Integer id) throws DataAccessLayerException {
        return (Perfil) super.find(Perfil.class, id);
    }

    /**
     * Updates the state of a detached Event.
     *
     * @param event
     */
    @Override
    public void update(Perfil perfil) throws DataAccessLayerException {
        super.saveOrUpdate(perfil);
    }

    /**
     * Finds all Events in the database.
     * @return
     */
    @Override
    public List<Perfil> findAll() throws DataAccessLayerException {
        return super.findAll(Perfil.class);
    }
}
